package Day5.ZuoYe;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

//2:计算当前时间距“世界末日”已经过去了多少天（2012-12-21）
public class ZuoYe2 {
    public static void main(String[] args) {
        Calendar c = Calendar.getInstance();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd EEEE");
        Date today = new Date();
        long today1=today.getTime();
        String s = format.format(today);
        System.out.println("今天的日期：" + s);
        c.set(2012, 11, 21);
        Date d = c.getTime();
        long d1=d.getTime();
        String s1=format.format(d);
        System.out.println("世界末日："+s1);
        long day=(today1-d1)/(24*3600*1000);
        System.out.print("当前时间距“世界末日”已经过去了"+day+"天");
    }
}
